﻿using MVC_DaLatServices.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVC_DaLatServices.Controllers
{
    public class HomeController : Controller
    {
        private DaLatServiceEntities db = new DaLatServiceEntities();
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            ViewData["Menu"] = db.Categories.ToList();
            db.ArticleFrontPages.ToList();

            return View(db.ArticleFrontPages.ToList());
        }
        //
        // GET: /GiaiTri/Details/2
        public ActionResult Details(int id = 0)
        {
            ViewData["Menu"] = db.Categories.ToList();
            Article article = db.Articles.Find(id);
            if (article == null)
            {
                return HttpNotFound();
            }
            return View(article);
        }
        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";
            ViewData["Menu"] = db.Categories.ToList();
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
